#include <iostream>
#include <vector>

using namespace std;

int maxSubArray(vector<int> &nums){
    int pre=0,maxAns=nums[0];
    for(const auto &x:nums)
    {
        pre=max(pre+x,x);
        maxAns=max(maxAns,pre);
    }
    return maxAns;
}
int main(){
    vector<int> nums;
    int num;
    while(cin>>num){
        nums.push_back(num);
        if(cin.get()=='\n')
        {
            break;
        }
    }
    int result=maxSubArray(nums);
    cout<<result<<endl;
    return 0;
}